package values.skill
{
	import core.manager.battle.BattleEffectManager;
	
	import values.avatar.IAvatarValue;

	/**
	 * 回合开始前 对范围内的人产生影响 
	 * @author azhang
	 * 
	 */	
	public class HurtRoundBuffDebuffValue extends BuffDebuffEffectValue
	{
		
		public static const HURT_MY_ROUND:String = "hurt_my_round";
		
		public function HurtRoundBuffDebuffValue()
		{
			super();
		}
		
		override public function effect():void
		{
			leftRound--;
			var num:Number;
			for each(var proV:BuffDebuffProTemplateValue in tempV.proDic)
			{
				if(proV.needUpdate && _hitter[proV.proName] != null)
				{
					if(!proV.isSpecial())
					{
						if(proV.needBaseNum)
						{
							num = _baseDamageNumber * _skillValue.getLevelValueByTag(proV.baseNum);
							_hitter[proV.proName] -= num;
						}
						else
						{
							num = SkillNumTypeKey.getResult(proV.numType , _hitter[proV.proName] , _skillValue.getLevelValueByTag(proV.baseNum));
							_hitter[proV.proName] -= num;
						}
						
						BattleEffectManager.showEffectValue(_owner , _hitter , {num:num , proName:proV.proName});
					}
					else
					{
						effectRound(proV);
					}
				}
			}
			
			if(leftRound == 0)
			{
				remove();
				return;
			}
		}
		
		private function effectRound(proV:BuffDebuffProTemplateValue):void
		{
			//通过地图的参数获取到这个列表
			var arr:Array = [];
			var num:Number = 0;
			for each(var av:IAvatarValue in arr)
			{
				if(proV.needBaseNum)
				{
					num = _baseDamageNumber * _skillValue.getLevelValueByTag(proV.baseNum);
					_hitter[proV.proName] -= num;
				}
				else
				{
					num = SkillNumTypeKey.getResult(proV.numType , _hitter[proV.proName] , _skillValue.getLevelValueByTag(proV.baseNum));
					_hitter[proV.proName] -= num;
				}
				BattleEffectManager.showEffectValue(_owner , _hitter , {num:num , proName:proV.proName});
			}
		}
	}
}